美团测开

刚做完美团点评的测试开发工程师的笔试题。20道单选,30道不定向选择,两道编程。包含逻辑题、数据结构、数据结构、计算机网络、C/C++语言、Java语言的内容等。
第一道编程题较简单,第二道似乎需要用动态规划,看到动态规划头都大了,最终也没搞出来,早知应该在选择题上多下点功夫。第一道编程题:所有学生三个人组成一队,N个会算法的,M个会编程的,三人队伍中至少有一个会算法,问最多能组成多少队伍。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = 0;
int m = 0;
while (sc.hasNextInt()) {
n = sc.nextInt();
m = sc.nextInt();
}
int a = (m + n) / 3;
int min = Math.min(m, n);
if (b < min ) {
min = b;
}
System.out.println(min);
}
}